<?php
namespace app\dynamic\model;

use app\BaseModel;


class Cate extends BaseModel
{


    protected $name = 'longbing_card_timeline_cate';


    /**
     * @author chenniang
     * @DataTime: 2020-07-24 10:26
     * @功能说明:列表
     */
    public function cateIist($dis,$page){

        $data = $this->where($dis)->order('top desc')->paginate($page)->toArray();

        return $data;
    }


    /**
     * @author chenniang
     * @DataTime: 2020-07-24 10:27
     * @功能说明:添加
     */
    public function cateAdd($data){

        $data['create_time'] = time();

        $data['update_time'] = time();

        $res = $this->insert($data);

        return $res;

    }


    /**
     * @author chenniang
     * @DataTime: 2020-07-24 10:27
     * @功能说明:编辑
     */
    public function cateUpdate($dis,$data){

        $data['update_time'] = time();

        $res = $this->where($dis)->update($data);

        return $res;
    }


    /**
     * @author chenniang
     * @DataTime: 2020-07-24 11:07
     * @功能说明:回显
     */
    public function cateInfo($dis){

        $data = $this->where($dis)->find();

        return !empty($data)?$data->toArray():[];

    }


    /**
     * @author chenniang
     * @DataTime: 2020-07-24 11:41
     * @功能说明:下拉框
     */
    public function cateSelect($dis){

        $data = $this->where($dis)->order('top desc')->select()->toArray();

        return $data;

    }



}